/**
 *
 */
package cn.aresoft.excel;


import cn.aresoft.excel.common.ImportExcelBase;
import cn.aresoft.excel.entity.ValidateMessage;

import java.io.InputStream;
import java.util.List;


/**
 * 导入Excel文件（支持“XLS”和“XLSX”格式）
 * @author yangfeng
 */
public class ImportExcel extends ImportExcelBase {


    private Class<? extends Object> clazz;

    private int startNum;


    /**
     * 构造函数
     * @param filePath
     * @param fileName
     * @throws Exception
     */
    public ImportExcel(Class<? extends Object> clazz, String filePath, String fileName,int startNum) throws Exception {
        super(filePath,fileName);
        this.clazz = clazz;
        this.startNum = startNum;
    }

    /**
     * 构造函数
     * @param clazz   要转换的对象的class对象
     * @param fileName    文件名称
     * @param inputStream    文件流
     * @param startNum    表头开始行序号
     * @throws Exception
     */
    public ImportExcel(Class<? extends Object> clazz, String fileName, InputStream inputStream,int startNum) {
        super(fileName,inputStream);
        this.clazz = clazz;
        this.startNum = startNum;
    }

    /**
     * 获得读取的对象集合
     * @return
     * @throws Exception
     */
    public <T> List<ValidateMessage> getDataList(List<T> objList) {
       return super.getSheetDataList(this.book.getSheetAt(0),this.startNum,clazz,objList);
    }


}
